package com.example.rabbitmq.provider;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Sender {

    @Value("${mq.config.exchange}")
    private String exchange;

    @Value("${mq.config.queue.info.routing.key}")
    private String routingInfoKey;

    @Value("${mq.config.queue.error.routing.key}")
    private String routingErrorKey;

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void routingInfoSend(String msg) {
        amqpTemplate.convertAndSend(exchange, routingInfoKey, msg);
    }

    public void routingErrorSend(String msg) {
        amqpTemplate.convertAndSend(exchange, routingErrorKey, msg);
    }

}
